﻿<UserControl x:Class="Google_Plus.Types.CommentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Google_Plus.Types"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="90" d:DesignWidth="480">

    <Grid Margin="0,10,0,0" Background="{StaticResource PhoneBackgroundBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="55" />
        </Grid.ColumnDefinitions>
        <Image VerticalAlignment="Top" 
               HorizontalAlignment="Right"
               Grid.Column="1"
               Width="48" Height="48" 
               Source="{Binding AuthorPhoto}"/>
        <StackPanel Margin="0,-6,0,0" x:Name="spContainer">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <TextBlock Text="{Binding StringFormat='+\{0\}', Path=PlusOneCount}" 
                           VerticalAlignment="Bottom" 
                           Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=HasPlusOne}"
                           Foreground="{Binding PlusOneButtonBrush}"/>
                <TextBlock Text="{Binding Information}"
                           VerticalAlignment="Bottom"/>
                <HyperlinkButton HorizontalContentAlignment="Right"
                                 NavigateUri="{Binding StringFormat=//Pages/ProfilePage.xaml?uid\=\{0\}, Path=AuthorID}"
                                 toolkit:TiltEffect.IsTiltEnabled="True">
                    <HyperlinkButton.Template>
                        <ControlTemplate TargetType="HyperlinkButton">
                            <TextBlock Text="{Binding Author}" 
                                       FontSize="{StaticResource PhoneFontSizeMedium}"
                                       Foreground="#FFA2A2FF"/>
                        </ControlTemplate>
                    </HyperlinkButton.Template>
                    <toolkit:ContextMenuService.ContextMenu>
                        <toolkit:ContextMenu>
                            <toolkit:MenuItem Header="View profile" FontWeight="Bold" x:Name="menuViewProfile" Click="menuViewProfile_Click"/>
                            <toolkit:Separator Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=CanMention}"/>
                            <toolkit:MenuItem Header="Mention" 
                                              x:Name="menuMention" 
                                              Click="menuMention_Click"
                                              Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=CanMention}"/>
                        </toolkit:ContextMenu>
                    </toolkit:ContextMenuService.ContextMenu>
                </HyperlinkButton>
            </StackPanel>
            <c4f:ChatBubble ChatBubbleDirection="UpperRight"
                            x:Name="cbContent"
                            HorizontalAlignment="Right">
                <local:RichTextHelper TextWrapping="Wrap"
                                      x:Name="rbContent"
                                      FontSize="{StaticResource PhoneFontSizeMedium}"
                                      RichText="{Binding Content}"/>
            </c4f:ChatBubble>
        </StackPanel>
        <toolkit:ContextMenuService.ContextMenu>
            <toolkit:ContextMenu>
                <toolkit:MenuItem Header="+1 the comment" Name="btnPlusOneComment" Click="btnPlusOneComment_Click"/>
                <toolkit:MenuItem Header="Copy content" Name="btnCopy" Click="btnCopy_Click" Visibility="Collapsed"/>
                <toolkit:Separator/>
                <toolkit:MenuItem Header="Report abuse"
                                  Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsMine, ConverterParameter=true}"/>
                <toolkit:MenuItem Header="Edit"
                                  Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsMine}" 
                                  Name="btnEditComment" Click="btnEditComment_Click"/>
                <toolkit:MenuItem Header="Delete comment"
                                  Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=IsMine}"
                                  Name="btnDeleteComment" Click="btnDeleteComment_Click"/>
            </toolkit:ContextMenu>
        </toolkit:ContextMenuService.ContextMenu>
    </Grid>
</UserControl>
